\(\int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx\) [125]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 24, antiderivative size = 48 \[ \int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx=-\frac {\text {arctanh}(\sin (c+d x))}{a^2 d}+\frac {2 i \sec (c+d x)}{d \left (a^2+i a^2 \tan (c+d x)\right )} \]

[Out]

-arctanh(sin(d*x+c))/a^2/d+2*I*sec(d*x+c)/d/(a^2+I*a^2*tan(d*x+c))

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {3581, 3855} \[ \int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx=-\frac {\text {arctanh}(\sin (c+d x))}{a^2 d}+\frac {2 i \sec (c+d x)}{d \left (a^2+i a^2 \tan (c+d x)\right )} \]

[In]

Int[Sec[c + d*x]^3/(a + I*a*Tan[c + d*x])^2,x]

[Out]

-(ArcTanh[Sin[c + d*x]]/(a^2*d)) + ((2*I)*Sec[c + d*x])/(d*(a^2 + I*a^2*Tan[c + d*x]))

Rule 3581

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[2*d^2*
(d*Sec[e + f*x])^(m - 2)*((a + b*Tan[e + f*x])^(n + 1)/(b*f*(m + 2*n))), x] - Dist[d^2*((m - 2)/(b^2*(m + 2*n)
)), Int[(d*Sec[e + f*x])^(m - 2)*(a + b*Tan[e + f*x])^(n + 2), x], x] /; FreeQ[{a, b, d, e, f, m}, x] && EqQ[a
^2 + b^2, 0] && LtQ[n, -1] && ((ILtQ[n/2, 0] && IGtQ[m - 1/2, 0]) || EqQ[n, -2] || IGtQ[m + n, 0] || (Integers
Q[n, m + 1/2] && GtQ[2*m + n + 1, 0])) && IntegerQ[2*m]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {2 i \sec (c+d x)}{d \left (a^2+i a^2 \tan (c+d x)\right )}-\frac {\int \sec (c+d x) \, dx}{a^2} \\ & = -\frac {\text {arctanh}(\sin (c+d x))}{a^2 d}+\frac {2 i \sec (c+d x)}{d \left (a^2+i a^2 \tan (c+d x)\right )} \\ \end{align*}

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(184\) vs. \(2(48)=96\).

Time = 0.44 (sec) , antiderivative size = 184, normalized size of antiderivative = 3.83 \[ \int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx=-\frac {\sec ^2(c+d x) \left (\cos \left (\frac {1}{2} (c+d x)\right ) \left (2 i+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+\left (2+i \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-i \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right ) \sin \left (\frac {1}{2} (c+d x)\right )\right ) \left (\cos \left (\frac {3}{2} (c+d x)\right )+i \sin \left (\frac {3}{2} (c+d x)\right )\right )}{a^2 d (-i+\tan (c+d x))^2} \]

[In]

Integrate[Sec[c + d*x]^3/(a + I*a*Tan[c + d*x])^2,x]

[Out]

-((Sec[c + d*x]^2*(Cos[(c + d*x)/2]*(2*I + Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + S
in[(c + d*x)/2]]) + (2 + I*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] - I*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2
]])*Sin[(c + d*x)/2])*(Cos[(3*(c + d*x))/2] + I*Sin[(3*(c + d*x))/2]))/(a^2*d*(-I + Tan[c + d*x])^2))

Maple [A] (verified)

Time = 0.73 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.12

method result size
derivativedivides \(\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\frac {4}{-i+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2} d}\) \(54\)
default \(\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\frac {4}{-i+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2} d}\) \(54\)
risch \(\frac {2 i {\mathrm e}^{-i \left (d x +c \right )}}{a^{2} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a^{2} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a^{2} d}\) \(61\)

[In]

int(sec(d*x+c)^3/(a+I*a*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

2/d/a^2*(1/2*ln(tan(1/2*d*x+1/2*c)-1)+2/(-I+tan(1/2*d*x+1/2*c))-1/2*ln(tan(1/2*d*x+1/2*c)+1))

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 64, normalized size of antiderivative = 1.33 \[ \int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx=-\frac {{\left (e^{\left (i \, d x + i \, c\right )} \log \left (e^{\left (i \, d x + i \, c\right )} + i\right ) - e^{\left (i \, d x + i \, c\right )} \log \left (e^{\left (i \, d x + i \, c\right )} - i\right ) - 2 i\right )} e^{\left (-i \, d x - i \, c\right )}}{a^{2} d} \]

[In]

integrate(sec(d*x+c)^3/(a+I*a*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-(e^(I*d*x + I*c)*log(e^(I*d*x + I*c) + I) - e^(I*d*x + I*c)*log(e^(I*d*x + I*c) - I) - 2*I)*e^(-I*d*x - I*c)/
(a^2*d)

Sympy [F]

\[ \int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx=- \frac {\int \frac {\sec ^{3}{\left (c + d x \right )}}{\tan ^{2}{\left (c + d x \right )} - 2 i \tan {\left (c + d x \right )} - 1}\, dx}{a^{2}} \]

[In]

integrate(sec(d*x+c)**3/(a+I*a*tan(d*x+c))**2,x)

[Out]

-Integral(sec(c + d*x)**3/(tan(c + d*x)**2 - 2*I*tan(c + d*x) - 1), x)/a**2

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 117 vs. \(2 (44) = 88\).

Time = 0.56 (sec) , antiderivative size = 117, normalized size of antiderivative = 2.44 \[ \int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx=-\frac {-2 i \, \arctan \left (\cos \left (d x + c\right ), \sin \left (d x + c\right ) + 1\right ) - 2 i \, \arctan \left (\cos \left (d x + c\right ), -\sin \left (d x + c\right ) + 1\right ) - 4 i \, \cos \left (d x + c\right ) + \log \left (\cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} + 2 \, \sin \left (d x + c\right ) + 1\right ) - \log \left (\cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} - 2 \, \sin \left (d x + c\right ) + 1\right ) - 4 \, \sin \left (d x + c\right )}{2 \, a^{2} d} \]

[In]

integrate(sec(d*x+c)^3/(a+I*a*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/2*(-2*I*arctan2(cos(d*x + c), sin(d*x + c) + 1) - 2*I*arctan2(cos(d*x + c), -sin(d*x + c) + 1) - 4*I*cos(d*
x + c) + log(cos(d*x + c)^2 + sin(d*x + c)^2 + 2*sin(d*x + c) + 1) - log(cos(d*x + c)^2 + sin(d*x + c)^2 - 2*s
in(d*x + c) + 1) - 4*sin(d*x + c))/(a^2*d)

Giac [A] (verification not implemented)

none

Time = 0.42 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.19 \[ \int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx=-\frac {\frac {\log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right )}{a^{2}} - \frac {\log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}{a^{2}} - \frac {4}{a^{2} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - i\right )}}}{d} \]

[In]

integrate(sec(d*x+c)^3/(a+I*a*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-(log(tan(1/2*d*x + 1/2*c) + 1)/a^2 - log(tan(1/2*d*x + 1/2*c) - 1)/a^2 - 4/(a^2*(tan(1/2*d*x + 1/2*c) - I)))/
d

Mupad [B] (verification not implemented)

Time = 4.06 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.92 \[ \int \frac {\sec ^3(c+d x)}{(a+i a \tan (c+d x))^2} \, dx=-\frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{a^2\,d}+\frac {4{}\mathrm {i}}{a^2\,d\,\left (1+\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}\right )} \]

[In]

int(1/(cos(c + d*x)^3*(a + a*tan(c + d*x)*1i)^2),x)

[Out]

4i/(a^2*d*(tan(c/2 + (d*x)/2)*1i + 1)) - (2*atanh(tan(c/2 + (d*x)/2)))/(a^2*d)